package com.month.ai.controller;

import com.month.ai.service.AiInteractionLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.ai.chat.messages.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/history")
@Tag(name = "会话记录模块")
public class chatHistoryController {

    @Autowired
    private  ChatMemory chatMemory;


    @Autowired
    private AiInteractionLogService aiInteractionLogService;

    @GetMapping("/list")
    @Operation(summary = "获取会话记录")
    public List<Message> getHistory(String chatId){
        return chatMemory.get(chatId, 99);
    }
}
